package com.wjbgn.bsolver.server.controller;

import com.wjbgn.bsolver.server.util.MinioUtil;
import com.wjbgn.stater.dto.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 文件控制器
 *
 * @author wjbgn
 * @date 2022/04/17 16:18
 **/
@Api(tags = "")
@RestController
@RequestMapping("/file")
@AllArgsConstructor
public class FileController {

    @Autowired
    private MinioUtil minioUtil;

    @ApiOperation(value = "minio上传")
    @PostMapping("/upload")
    public Result upload(@RequestParam(name = "multipartFile") MultipartFile[] multipartFile) {
        List<String> upload = minioUtil.upload(multipartFile);
        return Result.success(upload);
    }
}
